import { createRouter, createWebHistory } from 'vue-router'
import accountRoutes from './modules/account'
import proRoutes from './modules/pro'
import bannerRoutes from './modules/banner'

import Layout from '@/layout/index.vue'
import Home from '@/views/home/index.vue'
import Login from '@/views/login/index.vue'

export const constantRoutes = [
  {
    path: '/login',
    component: Login,
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: '/home',
        component: Home,
        meta: {
          title: '系统首页',
          icon: 'HomeFilled'
        }
      }
    ]
  }
]

export const asyncRoutes = [bannerRoutes, proRoutes, accountRoutes]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [...constantRoutes, ...asyncRoutes]
})

export default router
